package xyz.heyaoshare.validation.validator;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * 校验枚举值
 * @author YueHe
 * @version 0.0.1
 * @since 2025/6/25 上午10:36
 */
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = InEnumValidator.class)
public @interface InEnum {

    // 指定枚举类
    Class<? extends Enum<?>> value();

    // 是否可以为空 true:可以为空 false:不能为空(默认)
    boolean nullable() default false;

    String message() default "参数错误";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}